import java.util.*;
import java.math.*;

public class Fenzhi04{
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		String a  = reader.nextLine();
		String[] aa = a.split(" ");
		double x1 = Double.parseDouble(aa[0]);
		int x2 = Integer.parseInt(aa[1]);
		//String x1 = aa[0];
		//String x2 = aa[1];
		//System.out.println(x1+" "+x2);
		if (x1 <= 3)
		{
			double s;
			s = 10 + (double)( x2 /5)*2;
			BigDecimal sf = new BigDecimal(s); 
			System.out.println(sf.setScale(0,BigDecimal.ROUND_HALF_UP).intValue());

		}
		else if(x1 > 3 && x1 <= 10)
		{
			double s;
			s = (x1 -3)*2 + 10 + (double)( x2 /5)*2;
			BigDecimal sf = new BigDecimal(s); 
			System.out.println(sf.setScale(0,BigDecimal.ROUND_HALF_UP).intValue());
		}
		else if(x1 > 10)
		{
			double s;
			s = (x1-10)*3 + 24 + (double)( x2 /5)*2;
			BigDecimal sf = new BigDecimal(s); 
			System.out.println(sf.setScale(0,BigDecimal.ROUND_HALF_UP).intValue());

		}

	}
}